﻿<UserControl x:Class="Hisaab.Client.Modules.Core.Bill.View.BillEditor"
             xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation"
             xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml"
             xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
             xmlns:h="clr-namespace:Hisaab.Client.Common.Helpers;assembly=Hisaab.Client.Common"
             xmlns:d="http://schemas.microsoft.com/expression/blend/2008"
             xmlns:Model="clr-namespace:Hisaab.Client.Model;assembly=Hisaab.Client.Model" mc:Ignorable="d"
             d:DesignHeight="494" d:DesignWidth="440" Padding="6" >
    <StackPanel>
        <Label Style="{DynamicResource FieldLabel}">Name</Label>
        <TextBox Text="{Binding Path=SelectedBill.Name, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True}" MinWidth="300" />

        <Label Style="{DynamicResource FieldLabel}">Due Date</Label>
        <DatePicker SelectedDate="{Binding Path=SelectedBill.DueDate, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True}" MinWidth="300" Margin="5" />

        <Label Style="{DynamicResource FieldLabel}">Amount</Label>
        <TextBox Text="{Binding Path=SelectedBill.Amount, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True}" MinWidth="300" />

        <CheckBox IsChecked="{Binding SelectedBill.Paid}" Content="Bill Paid" Margin="5" />

        <Label Style="{DynamicResource FieldLabel}">Recurring Frequency</Label>
        <ComboBox SelectedValue="{Binding RecurringFequency}" ItemsSource="{Binding Source={h:Enumeration {x:Type Model:RecurringFrequencyTypes}}}"
                  SelectedValuePath="Value" Margin="6" >
            <ComboBox.ItemTemplate>
                <DataTemplate>
                    <TextBlock Text="{Binding Description}" VerticalAlignment="Center" Grid.Column="1" />
                </DataTemplate>
            </ComboBox.ItemTemplate>
        </ComboBox>

        <Label Style="{DynamicResource FieldLabel}">End Date For Recurring Bill</Label>
        <DatePicker SelectedDate="{Binding Path=SelectedBill.ExpiryDate, UpdateSourceTrigger=PropertyChanged, ValidatesOnDataErrors=True}" MinWidth="300" Margin="5" />

        <StackPanel HorizontalAlignment="Right" Orientation="Horizontal" Margin="0,10,0,0">
            <Button IsDefault="True" Width="75" Command="{Binding SaveCommand}">
                <Button.Content>
                    <StackPanel Orientation="Horizontal">
                        <Image Source="pack://application:,,,/Hisaab.Client.Common;component/Resources/Images/16/save.png" Width="16" Height="16" Margin="0 0 5 0" />
                        <TextBlock>Save</TextBlock>
                    </StackPanel>
                </Button.Content>
            </Button>
            <Button IsCancel="True" Width="75" Command="Close" >Cancel</Button>
        </StackPanel>
    </StackPanel>
</UserControl>